<template>
    <div class="login">
        <div class="login-form">
            <div class="login-header">
                <img src="../../assets/images/logo.png" height="80" alt="" />
                <p>{{ $Config.siteName }}</p>
            </div>
            <el-input placeholder="请输入用户名" suffix-icon="fa fa-user" v-model="userNmae" style="margin-bottom: 18px"> </el-input>

            <el-input
                placeholder="请输入密码"
                suffix-icon="fa fa-keyboard-o"
                v-model="password"
                type="password"
                style="margin-bottom: 18px"
                @keyup.native.enter="login"
            >
            </el-input>

            <el-button type="primary" :loading="loginLoading" style="width: 100%;margin-bottom: 18px" @click.native="login">登录</el-button>
            <div flex="main:justify cross:center">
                <el-button type="text" @click="goRouter('/registry')" style="float: right;color: #45d0c5;font-size: 14px">注册账户</el-button>
                <el-button type="text" @click="goRouter('/forgetPw')" style="float: right;color: #45d0c5;font-size: 14px">忘记密码</el-button>
            </div>
        </div>
    </div>
</template>

<script>
import { setToken } from "../../utils/dataStorage";
// import { login as loginApi } from "../../api/demo";

export default {
    data() {
        return {
            userNmae: "",
            password: "",
            Remenber: true,
            loginLoading: false
        };
    },
    methods: {
        goRouter(path) {
            this.$router.push({ path });
        },
        login() {
            // this.loginLoading = true;
            //loginApi({userNmae:this.userNmae,password:this.password}).then(r=>{}).catch(_=>{})
            setTimeout(() => {
                setToken("123456789");
                // this.$notify({
                //     title: "登录成功",
                //     message: "欢迎使用广告管理系统！",
                //     type: "success"
                // });
                // this.loginLoading = false;
                this.$router.push({ path: "/" });
            }, 1000);
        }
    }
};
</script>

<style lang="scss">
@import "Login.scss";
</style>
